<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<?php
echo "欢迎<br>";
try{
    $pdo = new PDO("mysql:dbname=liu;host=127.0.0.1","root","");
    $pdo->exec("SET NAMES 'utf8'");
    $sql = "SELECT *FROM log_user;";
    $res = $pdo->query($sql);

    echo "<table border='1'>";
    echo "<tr>
        <th>ID</th>
        <th>名字</th>
        <th>密码</th>
        <th>年龄</th>
        <th>操作</th>
    </tr>";
    foreach ($res as $v){
        echo "<tr>
        <td>{$v['log_id']}</td>
        <td>{$v['log_name']}</td>
        <td>{$v['log_pass']}</td>
        <td>{$v['log_age']}</td>
        <td>
            <a href='delete.php?id={$v['log_id']}'>删除</a> 
            <a href='update_html.php?id={$v['log_id']}&name={$v['log_name']}&pass={$v['log_pass']}'>修改</a>
        </td>
    </tr>";
    }
    echo "</table>";
}catch (PDOException $e){
    echo "错误信息：".$e->getMessage();
}
